//
//  AddDiaryViewController.m
//  NoteBook
//
//  Created by 云荒 on 15/11/11.
//  Copyright © 2015年 北落师门. All rights reserved.
//

#import "AddDiaryViewController.h"
#define kWidth self.view.frame.size.width
#define kHeight self.view.frame.size.height

@interface AddDiaryViewController () <UITextViewDelegate>

@property (nonatomic, retain) UITextView *textView;

@end

@implementation AddDiaryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor redColor];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"fanhui"] style:UIBarButtonItemStyleDone target:self action:@selector(leftBarButtonItemAction)];
//    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"发布" style:UIBarButtonItemStyleDone target:self action:@selector(rightBarButtonAction)];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.backgroundColor = [UIColor blueColor];
    btn.frame = CGRectMake(0, 0, 50, 25);
    btn.layer.cornerRadius = 10;
    [btn addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside];
    btn.titleLabel.font = [UIFont systemFontOfSize:13];
    btn.layer.masksToBounds = YES;
    [btn setTitle:@"发布" forState:UIControlStateNormal];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
    
    self.textView = [[UITextView alloc] initWithFrame:CGRectMake(10, 20, kWidth - 20, 200)];
    self.textView.delegate = self;
    self.textView.selectedRange = NSMakeRange(0, 0);//设置位置
    self.textView.font = [UIFont systemFontOfSize:17];
    self.textView.contentInset = UIEdgeInsetsMake(-11, -6, 0, 0);
    self.textView.backgroundColor = [UIColor yellowColor];
    
    [self.view addSubview:self.textView];
    //取消iOS7的边缘延伸效果（例如导航栏，状态栏等等）
//    self.modalPresentationCapturesStatusBarAppearance = NO;
    self.edgesForExtendedLayout = UIRectEdgeNone;
//    self.extendedLayoutIncludesOpaqueBars = NO;
    
}

- (void)btnAction {
    NSLog(@"发布");
}
- (void)leftBarButtonItemAction {
    NSLog(@"返回");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
